<?php
/**
 * File:          KValidator_Parameter_Text_Length
 * Description:   -
 * Author:        Kovac "Kovacou'" Alexandre (www.kovacou.fr)
 * Last Update:   21/04/2011
 */

   class KValidator_Parameter_Text_Length implements KValidatorParameter {
      public  $min = null,
              $max = null;
      
      public function valid ($value, $config) {
         $strlen = strlen ($value);
         
         if ($this->min !== null && $strlen < $this->min)
            return "Trop court: <strong>{$this->min}</strong> caractères minimum !";
         elseif ($this->max !== null && $strlen > $this->max)
            return "Trop long: <strong>{$this->max}</strong> caractères maximum !";
      }
   }
 
/**
 * End
 * Of
 * File
 */
?>